<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
	$(function() {
		var type = "${user.type}";
		$("#user-form").find("select[name='user.sex']").val("${user.sex}");
		$("#user-form").find("select[name='user.type']").val(type);
		$("#user-form").find("select[name='user.grade']").val("${user.grade}");
		$("#user-form").find("select[name='user.major']").val("${user.major}");
		if(type==2) {
			$("#grade-p").show();
			$("#major-p").show();
		}
		$("#user-form").find("input").attr("readonly", "readonly");
	})
</script>
<form id="user-form">
	<h3 class="thin underline">用户信息</h3>
	<p class="inline-label button-height">
		<label class="label">用户名：</label>
		<input type="text" name="user.loginname" class="input" value="${user.loginname }">
	</p>
	<p class="inline-label button-height">
		<label class="label">姓名：</label>
		<input type="text" name="user.username" class="input" value="${user.username }">
	</p>
	<p class="inline-label button-height">
		<label class="label">性别：</label>
		<select name="user.sex" class="select">
			<option value="">--请选择--</option>
			<c:forEach items="${sexs }" var="sex">
				<option value="${sex.value }">${sex.name }</option>
			</c:forEach>
		</select>
	</p>
	<p class="inline-label button-height">
		<label class="label">类型：</label>
		<select name="user.type" class="select">
			<option value="">--请选择--</option>
			<option value="0">管理员</option>
			<option value="1">教师</option>
			<option value="2">学生</option>
			<option value="3">专家</option>
		</select>
	</p>
	<p class="inline-label button-height">
		<label class="label">民族：</label>
		<input type="text" name="user.nation" class="input" value="${user.nation }">
	</p>
	<p class="inline-label button-height">
		<label class="label">电话：</label>
		<input type="text" name="user.tel" class="input" value="${user.tel }">
	</p>
	<p class="inline-label button-height">
		<label class="label">邮箱：</label>
		<input type="text" name="user.email" class="input" value="${user.email }">
	</p>
	<p class="inline-label button-height" id="grade-p" style="display:none;">
		<label class="label">年级：</label>
		<select name="user.grade" class="select">
			<option value="">--请选择--</option>
			<c:forEach items="${grades }" var="grade">
				<option value="${grade.value }">${grade.name }</option>
			</c:forEach>
		</select>
		</select>
	</p>
	<p class="inline-label button-height" id="major-p" style="display:none;">
		<label class="label">专业：</label>
		<select name="user.major" class="select">
			<option value="">--请选择--</option>
			<c:forEach items="${majors }" var="major">
				<option value="${major.value }">${major.name }</option>
			</c:forEach>
		</select>
	</p>
</form>
